﻿#if UNITY_EDITOR
using System;
using UnityEngine;
/// <summary>
/// GUI操作类别枚举
/// </summary>
[Flags]
[ESF_AliasTooltip("GUI操作类别")]
public enum ESF_enGUIOperationClassify
{
    /// <summary>
    /// 所有操作
    /// </summary>
    [ESF_AliasTooltip("所有操作")]
    All = -1,
    /// <summary>
    /// 无操作
    /// </summary>
    [ESF_AliasTooltip("无操作")]
    None = 0 ,
    /// <summary>
    /// 新增操作
    /// </summary>
    [ESF_AliasTooltip("新增")]
    Add = 1 << 0,
    /// <summary>
    /// 删除操作
    /// </summary>
    [ESF_AliasTooltip("删除")]
    Delete = 1 << 1,
    /// <summary>
    /// 修改操作
    /// </summary>
    [ESF_AliasTooltip("修改")]
    Modify = 1 << 2,
    /// <summary>
    /// 选择路径
    /// </summary>
    [ESF_AliasTooltip("选择路径")]
    SelectPath = 1 << 3,
}
/// <summary>
/// GUI操作特性
/// </summary>
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class ESF_GUIOperationAttribute : PropertyAttribute
{
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="_operation">操作</param>
    public ESF_GUIOperationAttribute(ESF_enGUIOperationClassify _operation = ESF_enGUIOperationClassify.All)
    {
        operation = _operation;
    }

    /// <summary>
    /// 是否包含指定操作
    /// </summary>
    /// <param name="_operation">操作</param>
    /// <returns>true:是,false:否</returns>
    public bool hasOperation(ESF_enGUIOperationClassify _operation)
    {
        return (operation & _operation) == _operation;
    }

    /// <summary>
    /// 操作
    /// </summary>
    public ESF_enGUIOperationClassify operation { get; private set; }
}
#endif
